Inspection apparatus, inspection method, and program

ABSTRACT

A photometric processing part calculates a normal vector of a surface of a workpiece from a plurality of luminance images acquired by a camera in accordance with the photometric stereo method, and performs synthesis processing of synthesizing at least two images out of an inclination image made up of pixel values based on the normal vector calculated from the plurality of luminance images and at least one reduced image of the inclination image, to generate an inspection image showing a surface shape of the inspection target. In particular, a characteristic size setting part sets a characteristic size which is a parameter for giving weight to a component of a reduced image at the time of performing the synthesis processing. The photometric processing part can generate a different inspection image in accordance with the set characteristic size.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims foreign priority based on Japanese PatentApplication No. 2014-119099, filed Jun. 9, 2014, the contents of whichis incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an inspection apparatus, an inspectionmethod, and a program.

2. Description of Related Art

In order to measure an accurate three-dimensional shape of a workpiece(inspection target product) by using a photometric stereo principle,there is required an illumination light source whose illumination lightis incident on each surface of the workpiece with a uniform lightamount. Further, an angle of incidence of the illumination light isrequired to be known. Moreover, since the angle of incidence of lightshould not change in accordance with a region of the workpiece, there isrequired an illumination light source having a size corresponding to thesize of the workpiece to be inspected. Furthermore, scale information(actual dimension per pixel) of an image captured by a camera is alsorequired. A visual inspection apparatus is often installed by a user,and it is difficult for the user to satisfy these strict installationconditions. Therefore, according to JP 2007-206797 A, a dedicatedapparatus formed by integrating illumination and a camera is proposed,to thereby reduce a burden of installation of the user.

According to the invention described in JP 2007-206797 A, since theillumination and the camera are integrated, there is an advantage ofreducing the burden of installation of the user. Nevertheless, a visualinspection apparatus using the photometric stereo principle has notprevailed in the market. There are several reasons for this. Accordingto JP 2007-206797 A, a normal vector image (an image in which each pixelshows a normal vector of the surface of the workpiece) or a reflectanceimage (an image in which each pixel shows a reflectance of the surfaceof the workpiece), obtained by using the photometric stereo principle,is applied to image inspection. Accordingly, in the invention of JP2007-206797 A, an applicable application is limited. For example, thereflectance image is useful for inspection of a workpiece having on itssurface a number of glittering portions where luminance is saturated,and the like, but the reflectance image is not suitable for inspectionof a fine uneven flaw on the surface of the workpiece or for OCR(optical character recognition) of an inscribed character. Meanwhile, inthe inspection application such as the inspection of the fine unevenflaw on the surface of the workpiece or the OCR of the inscribedcharacter, strict installation conditions are not required.

However, in such an inspection application, the user is required toadjust several image processing parameters at the time of generating animage for inspection from the normal vector image or the reflectanceimage. Hence, a burden of the user is desirably reduced also for thisadjustment operation.

SUMMARY OF THE INVENTION

Therefore, an object of the present invention is to facilitate settingof a parameter at the time of generating an inspection image from animage acquired by using a photometric stereo principle.

According to the present invention, for example, there is provided aninspection apparatus including: an illumination section for illuminatingan inspection target in accordance with a photometric stereo method; animaging section for receiving reflective light from the illuminatedinspection target to generate a luminance image in accordance with thephotometric stereo method; a computing section for calculating a normalvector of a surface of the inspection target from a plurality ofluminance images acquired by the imaging section, and performingaccumulation computing of a pixel value of a pixel of interest by usinga normal vector of a pixel adjacent to the pixel of interest withrespect to an inclination image made up of pixel values based on thenormal vector calculated from the plurality of luminance images and areduced image of the inclination image, to generate an inspection imagehaving the pixel value; and a determination section for determiningdefectiveness/non-defectiveness of the inspection target by using theinspection image, the inspection apparatus further including a settingsection for setting a characteristic size which is a parameter forgiving weight to a component of the reduced image used in theaccumulation computing.

According to the present invention, by introducing the concept of acharacteristic size, a parameter can be easily set at the time ofgenerating an inspection image from an image acquired by using thephotometric stereo principle.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a view showing an outline of an inspection apparatus;

FIGS. 2A to 2C provide a view for describing a photometric stereoprinciple;

FIG. 3 is a diagram for describing accumulation computing;

FIG. 4 is a diagram showing a method for deciding weight based on acharacteristic size;

FIG. 5 is a view showing one example of inspection images with differentcharacteristic sizes;

FIG. 6 is a view describing images related to generation of a shapeimage;

FIG. 7 is a view describing a method for generating a texture image;

FIG. 8 is a function block diagram of the inspection apparatus;

FIG. 9 is a flowchart showing a setting mode;

FIG. 10 is a view showing one example of a user interface;

FIG. 11 is a view showing one example of the user interface;

FIG. 12 is a view showing one example of the user interface;

FIG. 13 is a view showing one example of the user interface;

FIG. 14 is a view showing one example of the user interface;

FIG. 15 is a view showing one example of the user interface;

FIG. 16 is a view showing one example of the user interface;

FIG. 17 is a view showing one example of the user interface;

FIG. 18 is a view showing one example of the user interface;

FIG. 19 is a view showing one example of the user interface;

FIG. 20 is a flowchart showing an inspection mode;

FIG. 21 is a view showing one example of the user interface;

FIG. 22 is a view showing one example of the user interface;

FIG. 23 is a view showing one example of the user interface;

FIG. 24 is a view showing one example of the user interface;

FIG. 25 is a view showing one example of the user interface; and

FIG. 26 is a view showing one example of the user interface.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENT

Hereinafter, one embodiment of the present invention is shown. Anindividual embodiment described below will be useful for understanding avariety of concepts such as a superordinate concept, an intermediateconcept, and a subordinate concept of the present invention. Further, atechnical range of the present invention is defined by the claims, andis not limited by the following individual embodiment.

FIG. 1 is a view showing one example of a visual inspection system. Aline 1 is a conveyer belt for conveying a workpiece 2 which is aninspection target. An illumination apparatus 3 is one example of anillumination section for illuminating an inspection target in accordancewith a photometric stereo method. A camera 4 is one example of animaging section for receiving reflective light from the illuminatedinspection target to generate a luminance image in accordance with thephotometric stereo method. An image processing apparatus 5 is a visualinspection apparatus for calculating a normal vector of the surface ofthe workpiece 2 from a plurality of luminance images acquired by thecamera 4, performing accumulation computing of a pixel value of a pixelof interest by using a normal vector of a pixel adjacent to the pixel ofinterest with respect to an inclination image made up of pixel valuesbased on the normal vector calculated from the plurality of luminanceimages and a reduced image of the inclination image, and generating aninspection image having the pixel value, to determinedefectiveness/non-defectiveness of the inspection target by using theinspection image. The inclination image may be referred to as a normalvector image. The image processing apparatus 5 may create a reflectanceimage (albedo image) from the luminance image. A display part 7 displaysa user interface for setting a control parameter related to inspection,an inclination image, a reflectance image, an inspection image, and thelike. An input part 6 is a console, a pointing device, and a keyboard,and is used for setting a control parameter.

<Photometric Stereo Principle>

In a general photometric stereo method, as shown in FIG. 2A,illumination light L1 to illumination light L4 are applied to theworkpiece 2 from four directions while being switched, to generate fourluminance images. The direction of the illumination light used at thetime of capturing each luminance image is in only one direction. Notethat a luminance image is made up of a plurality of pixels, and fourpixels whose coordinates match in the four luminance images correspondto the same surface of the workpiece. Expression 1 shown in FIG. 2B isestablished among pixel values (luminance values) I1, I2, I3, I4 of thefour pixels and the normal vector n. Here, ρ is a reflectance. L is alight amount of the illumination light from each direction, and isknown. Here, the light amounts from the four directions are the same. Sis an illumination-direction matrix, and is known. By solving thismathematical expression, the reflectance ρ and the normal vector n foreach coordinates (surface of the workpiece) are obtained. As a result, areflectance image and an inclination image are obtained.

In the present embodiment, further, a height component is extracted fromthe inclination image to create, as the inspection image, a shape imageshowing a shape of the workpiece. The inspection image is obtained by anaccumulation computing equation which is Expression 2 shown in FIG. 2C.Here, zn is a result of n-th accumulation and shows the shape of thesurface of the workpiece, x and y indicate coordinates of a pixel, and nshows how many times iteration calculation has been performed. Moreover,p shows an inclination component in a horizontal direction, q shows aninclination component in a vertical direction, p and q are obtained fromthe normal vector n, and w is weight. Further, a 1/1-inclination imageis used in first accumulation computing, a ½-reduced inclination imageis used in second accumulation computing, and a ¼-reduced inclinationimage is used in third accumulation computing. At the time of creatingthe reduced image, reduction processing may be performed after Gaussianprocessing is performed.

In the present embodiment, a parameter called a characteristic size isadopted in the accumulation computing. The characteristic size is aparameter for giving weight to a component of a reduced image to be usedin the accumulation computing. The characteristic size is a parametershowing a size of a surface shape of the workpiece 2. For example, whenthe characteristic size is 1, weight with respect to four pixelsadjacent to a pixel of interest in an x-y direction is set the largestand the accumulation computing is performed. When the characteristicsize is 2, weight with respect to eight pixels adjacent to the pixel ofinterest in the x-y direction is set the largest and the accumulationcomputing is performed. However, since computing using the eight pixelscauses an increase in computing amount, the foregoing reduced image iscreated and used for the computing. That is, in place of using the eightadjacent pixels, the inclination image is reduced into ½ and thecomputing is performed. Thereby, concerning a certain pixel of interest,four pixels in the reduced image may be considered for the computing.Also when the characteristic size is increased to 4, 8, 16, and 32,reduced images corresponding thereto are created, and weight withrespect to the reduced image corresponding to the characteristic size isset the largest, whereby a similar effect of reduction in computing loadcan be obtained.

FIG. 3 shows one example of the accumulation computing. In this example,two inclination images (an image with a horizontal inclination componentp and an image with a vertical inclination component q) obtained fromthe normal vector n are inputted. First, a whole shape is accumulated byan inclination image with a large reduction degree, and a fine shape isaccumulated by an image with a smaller reduction degree. This allowsrestoration of the whole shape in a short period of time. According toFIG. 3, for example, with respect to the 1/32-reduced image, z which isa parameter indicating the shape of the surface of the workpiececoncerning the pixel of interest is calculated by Expression 2. Theweight w is decided in accordance with the characteristic size. Eachpixel constituting the reduced image is taken as a pixel of interest,and the accumulation computing is subjected to iteration (repetitionprocessing). An initial value of z is zero. Then, z is calculated withrespect to the 1/16-reduced image in accordance with Expression 2. Here,an inclination component of the 1/16-reduced image is accumulated on aresult of the computing of 1/32. Similarly, the accumulation computingis performed from the ⅛-reduced image to the 1/1-image.

FIG. 4 shows one example of weight with respect to each characteristicsize. A horizontal axis indicates a resolution level (reduction degree),and a vertical axis indicates weight. As can be seen from FIG. 4, in thecharacteristic size 1, weight is the largest at level 0 (1/1-image) withthe smallest reduction degree. This allows accumulation of a finershape. In the characteristic size 2, weight is the largest at level 1(½-image). This allows further accumulation of a shape having a largersize. As thus described, each weight is decided such that a peak isgenerated at the level corresponding to the characteristic size.

As a method for restoring the shape image, other than the aboveaccumulation computing, it is also possible to adopt known Fouriertransform integration (“A Method for Enforcing Integrability in Shapefrom Shading Algorithms”, IEEE Transactions on Pattern Analysis andMachine Intelligence, Vol. 10, No. 4 July 1988). Also in this method, itis possible to change a characteristic size to be extracted bygenerating a reduced image in a calculation process and adjusting aweighting component.

FIG. 5 shows one example of inspection images in accordance withdifferences in characteristic size. It can be seen that a fine shape isextracted in the characteristic size 4, a whole shape is extracted inthe characteristic size 64, and a shape of an intermediate sizetherebetween is extracted in the characteristic size 16. In such amanner, a small characteristic size is useful for inspecting a fineflaw, a large characteristic size is suitable for discriminating thepresence or absence of an object, and an intermediate characteristicsize is suitable for OCR of an uneven character, and the like. That is,selecting a suitable characteristic size in accordance with theinspection tool can improve the inspection accuracy.

FIG. 6 is a view showing a step of creating an inspection image by thephotometric stereo method. Luminance images 601 to 604 are luminanceimages acquired by illuminating the workpiece 2 with illumination lightfrom respectively different illumination directions. Note that aluminance image 600 is a luminance image obtained by simultaneouslyilluminating the workpiece 2 from four directions. A normal vector ofthe surface of the workpiece is obtained by computing from the pluralityof luminance images acquired by illuminating the workpiece 2 with theillumination light from the respectively different illuminationdirections. An inclination image 611 is an inclination image whose pixelvalue is an inclination component in an x-direction of the normal vectorobtained from the luminance images 601 to 604. An inclination image 612is an inclination image whose pixel value is an inclination component ina y-direction of the normal vector obtained from the luminance images601 to 604. A reflectance image 610 is a reflectance image obtained byremoving an amount of change in luminance value due to inclination ofthe surface of the workpiece from the normal vector obtained from theluminance images 601 to 604, to form an image with a reflectance of thesurface of the workpiece. Inspection images 621 to 623 are images withrespectively different characteristic sizes obtained from theinclination images 611, 612. Each of the inspection images 621 to 623 isalso made up of pixels based on an inclination component, and is thus atype of the inclination image. In such a procedure, the inspection imageof the workpiece 2 is generated. Note that the luminance image 600 orthe reflectance image 610 as an all-directional illumination image maybe adopted as the inspection image, depending on the inspection tool.The all-directional illumination image is a luminance image acquired bylighting all of a plurality of light sources provided in theillumination apparatus 3.

<Texture Information>

Texture information is information based on the reflectance ρ of thesurface of the workpiece 2. The reflectance ρ is obtained by Expression1, namely, one reflectance image is obtained from four luminance images.The reflectance image is an image having a pixel value proportional tothe reflectance ρ of the surface of the workpiece. As shown in FIG. 7, anormal vector is calculated from four luminance images 701 to 704, andbased on the calculated normal vector and a luminance value of a pixelcorresponding to each of the plurality of luminance images, a pixelvalue proportional to a reflectance of each pixel is calculated, toobtain texture images 711, 712 which are reflectance images. Examples ofthis synthesis method includes a method of averaging pixels of the fourluminance images to obtain a texture image, and a method of removinghalation from the four luminance images and then averaging pixels toobtain a texture image. The texture image 711 is one example of theimage obtained by averaging pixels, and the texture image 712 is oneexample of the image obtained by removing halation. In the fourluminance images, four pixels whose coordinates match exist. It ispossible to remove halation by removing a pixel with the largest pixelvalue out of the four pixels, or by removing pixels with the largest toN-th largest pixel values (N is a natural number not larger than 3).This is because halation appears as high luminance in the image. Boththe texture images 711, 712 are made up of pixels based on thereflectance, and are thus types of the reflectance image.

<Function Block>

FIG. 8 is a block diagram of the inspection apparatus. In this example,the illumination apparatus 3, the camera 4, and the image processingapparatus 5 are respectively housed in separate housings, but this ismerely an example, and the illumination apparatus 3, the camera 4, andthe image processing apparatus 5 may be integrated as appropriate. Theillumination apparatus 3 is one example of the illumination section forilluminating the inspection target in accordance with the photometricstereo method, and provided with a light source group 801 and anillumination controller 802 for controlling this light source group. Onesegment may be formed of a plurality of light-emitting elements, and thelight source group 801 may be formed of a plurality of segments. Thenumber of segments is generally four, but may be any number as long asit is not smaller than three. This is because an inspection image can begenerated by the photometric stereo method if the workpiece 2 can beilluminated from three or more illumination directions. As shown in FIG.1, an outer shape of the illumination apparatus 3 may be a ring shape.Further, the illumination apparatus 3 may be configured by a pluralityof illumination units each separated from one another. For example,although illumination units that are used for capturing an image of theworkpiece 2 exist in the market, these illumination units are notdeveloped for photometric stereo. However, the illumination apparatus 3may be configured by preparing a plurality of such illumination unitsand connecting an illumination controller for controlling theseillumination units. The illumination controller 802 controls lightingtiming and a lighting pattern of the light source group 801 inaccordance with a control command from the image processing apparatus 5.Although a description will be given assuming that the illuminationcontroller 802 is incorporated in the illumination apparatus 3, theillumination controller 802 may be incorporated in the camera 4 or inthe image processing apparatus 5, or may be housed in a housingindependent of these.

The camera 4 is one example of the imaging section for receivingreflective light from the illuminated inspection target to generate aluminance image in accordance with the photometric stereo method, andperforms the imaging processing in accordance with a control commandfrom the image processing apparatus 5. The camera 4 may create aluminance image of the workpiece 2 and transmit the luminance image tothe image processing apparatus 5, or the camera 4 may transmit aluminance signal obtained from an imaging element to the imageprocessing apparatus 5 and the image processing apparatus 5 may generatea luminance image. Since the luminance signal is a signal used forgenerating the luminance image, the luminance signal is also theluminance image in a broad sense.

The image processing apparatus 5 has a processor 810 such as a CPU andan ASIC, a storage device 820 such as a RAM, a ROM, and a portablestorage medium, an image processing part 830 such as an ASIC, and acommunication part 850 such as a network interface. The processor 810serves to set an inspection tool and generate an inspection image. Aphotometric processing part 811 functions as a computing section forcalculating the normal vector n of the surface of the workpiece 2 from aplurality of luminance images acquired by the camera 4, and performingaccumulation computing of a pixel value of a pixel of interest by usingthe normal vector n of a pixel adjacent to the pixel of interest withrespect to an inclination image having a pixel value based on the normalvector n calculated from the plurality of luminance images and a reducedimage of the inclination image, to generate an inspection image havingthe pixel value. Note that, specifically, the inspection image isgenerated by using the foregoing mathematical expression or the like. Anillumination control part 812 transmits a control command to theillumination controller 802 to control an illumination pattern,illumination switching timing, or the like. An imaging control part 813controls the camera 4. A UI managing part 814 displays on the displaypart 7 a user interface (UI) for setting an inspection tool, a UI forsetting a parameter required for generating an inspection image, and thelike, and sets the inspection tool and the parameter in accordance withinformation inputted from the input part 6. In particular, acharacteristic size setting part 815 functions as a setting section forsetting a characteristic size which is a parameter for giving weight wto a component of a reduced image that is used in the accumulationcomputing. An image selection part 816 selects an image to be displayedor the like, out of a plurality of luminance images, a plurality ofinspection images, a plurality of inclination images, and a plurality ofreflectance images. The image selection part 816 may select an image,which is to be saved or outputted, out of the plurality of luminanceimages acquired by the camera 4 and the inspection image. An inspectiontool setting part 817 sets an inspection tool for the inspection imageselected by the image selection part 816. A reference image setting part818 sets a reference image acquired from a non-defective product. Theinspection tool setting part 817 may include the characteristic sizesetting part 815, the image selection part 816, the reference imagesetting part 818, and a condition setting part 819. The image processingpart 830 functions as an inspection region setting section for executinga pattern search on an inspection image by using the reference image, toset an inspection region in the inspection image. The inspection regionis, for example, a character recognition region. The condition settingpart 819 sets a condition for outputting an image to an external deviceconnected to the display part 7 or the communication part 850, or sets acondition for saving an image into a portable storage medium. Adetermination part 840 functions as a determination section fordetermining defectiveness/non-defectiveness of the workpiece 2 by usingthe inspection image. For example, the determination part 840 receives aresult of the inspection executed in the image processing part 830 byusing the inspection image and determines whether or not the inspectionresult satisfies a non-defective product condition (tolerance or thelike).

The storage device 820 stores luminance image data 821 which is data ofthe luminance image acquired by the camera 4, and inclination image data822 and reflectance image data 823 generated by the photometricprocessing part 811. Further, the storage device 820 also stores avariety of setting data, a program code for generating a user interface,and the like. The storage device 820 may store and hold inspectionimages with respectively different characteristic sizes. Further, inaddition to the inspection image, the storage device 820 may also storeinclination image data or reflectance image data used for generating theinspection image. When erroneous determination on the workpiece 2 isfound, these pieces of data may be useful for specifying which of theinspection image, the inclination image, and the reflectance image has aproblem and correcting its control parameter.

The image processing part 830 executes visual inspection by using theinspection image (the inclination image data 822, the reflectance imagedata 823) generated by the photometric processing part 811. A flawinspection part 831 executes flaw inspection on a plurality ofinspection images generated by using respectively differentcharacteristic sizes. An OCR part 832 functions as a characterrecognition processing section for performing character recognitionprocessing on a plurality of inspection images generated by usingrespectively different characteristic sizes. The flaw inspection part831 and the OCR part 832 may read the inspection image (the inclinationimage data 822, the reflectance image data 823) stored in the storagedevice 820 and execute inspection, to write an inspection result intothe storage device 820 or to pass the inspection result to thedetermination part 840. The determination part 840 determinesdefectiveness/non-defectiveness of the workpiece 2 based on thisinspection result.

<Setting Mode>

The inspection system has a setting mode for setting an inspection tooland an inspection mode (operation mode) for executing a visualinspection of the workpiece 2 in accordance with the set inspectiontool. Here, one example of the setting mode will be described.

FIG. 9 is a flowchart concerning the setting mode. When the start of thesetting mode is designated through the input part 6, the UI managingpart 814 of the processor 810 displays a UI for setting the inspectiontool on the display part 7.

FIG. 10 shows one example of the UI. A UI 1000 displayed on the displaypart 7 by the UI managing part 814 is provided with a pull-down menu1001 for designating a saving destination of an inspection result, and atext box 1002 for inputting a name of the inspection tool. Whendetecting pressing-down of a run button, the UI managing part 814displays the next UI.

A UI 1100 shown in FIG. 11 has guidance 1101 for setting the inspectiontool, a measurement run button 1102 for designating the camera 4 toperform imaging, a display region 1103 for displaying an image capturedby the camera 4, and a camera setting button 1104 for designating thestart of setting of the camera. An image selection part 1105 is a buttonfor selecting an image to be displayed in the display region 1103 or animage to be used for the inspection. In this example, any one image outof a shape 1, a shape 2, a texture, and normal is optionally selected bythe image selection part 1105. When the measurement run button 1102 isoperated, the imaging control part designates the camera 4 to performimaging. The UI managing part 814 renders a luminance image acquired bythe camera 4 to the display region 1103. Note that, when another imageis selected by the image selection part 1105, the UI managing part 814renders the image selected by the image selection part 1105 to thedisplay region 1103. As thus described, the user can switch an imagedisplayed in the display region 1103 by operating the image selectionpart 1105 or designating switching of the image through the input part6. When the camera setting button 1104 is operated, the UI managing part814 performs switching to the next UI.

In S901, the UI managing part 814 displays a UI for setting the camera 4on the display part 7, to execute setting of the camera. FIG. 12 showsone example of a camera setting UI 1200. A camera setting tab 1201 has apull-down menu 1202 for setting a model of a camera, a pull-down menu1203 for setting an image size, a pull-down menu 1204 for setting ashutter speed, and a slider 1205 for setting the sensitivity of thecamera. When the measurement run button 1102 is operated, the UImanaging part 814 displays in the display region 1103 a luminance imageacquired by the camera 4 in accordance with an imaging parameter set atthat point. Hence, it is possible to determine whether or not the setparameter is suitable.

In S902, the UI managing part 814 displays a UI for setting photometricprocessing on the display part 7, to execute the setting. For example,when detecting that a photometric stereo setting tab 1210 provided inthe camera setting UI 1200 is operated, the UI managing part 814switches the photometric stereo setting tab 1210 to be enabled, as shownin FIG. 13. Switching the photometric stereo setting tab 1210 to beenabled means switching a display state of the photometric stereosetting tab 1210 to a user operable state. The photometric stereosetting tab 1210 includes a pull-down menu 1301 for selecting an imageand a characteristic size setting part 1302. In this example, it isassumed that any of three inspection images (shape 1, shape 2, shape 3)with respectively different characteristic sizes can be selected. Acharacteristic size is set by the characteristic size setting part 1302for each image selected by the pull-down menu 1301.

A selection part for selecting an illumination pattern may be arrangedin the photometric stereo setting tab 1210. Further, a designation partfor designating an amount of emission for one illumination may beprovided.

In S903, the UI managing part 814 displays a UI for setting theinspection tool on the display part 7, to execute the setting. FIG. 14is one example of a UI 1400 for setting the inspection tool. An imageselection button 1401 is a button for selecting an inspection image tobe used for inspection out of a plurality of inspection images. Aninspection category selection button 1402 is a button for selecting acategory of a tool to be added as the inspection tool out of a pluralityof inspection categories. A recognition target setting button 1403 is abutton for selecting one out of a plurality of recognition targets. Inthis example, “shape 1” is selected as the inspection image,“recognition” is selected as the category, and “character recognition”is selected as the recognition processing. When an addition button 1404is operated, the UI managing part 814 performs switching to the next UI.FIG. 15 shows a reference image registration UI 1500. The referenceimage registration UI 1500 is provided with a registration button 1501in addition to the measurement run button 1102 and the display region1103 described above. When the registration button 1501 is operated, theUI managing part 814 registers as the reference image an image acquiredby the measurement run button 1102 and displayed in the display region1103. When the registration is completed, the UI managing part 814performs switching to the next UI.

FIG. 16 shows a measurement region setting UI 1600. The display region1103 of the measurement region setting UI 1600 is provided with areference image 1601 and a frame 1602 showing a measurement region. TheUI managing part 814 changes a position and a size of the frame 1602 inaccordance with designation from the input part 6. The user adjusts theposition and the size of the frame 1602 in accordance with a positionand a size of a portion to be measured in the reference image 1601. TheUI managing part 814 further executes character segmenting setting, ordictionary setting for registering a specific example (character image)of a character to be recognized, a character corresponding to thecharacter image, and the like.

Next, a flaw inspection tool will be described. As shown in FIG. 17,when the flaw inspection is selected by the inspection categoryselection button 1402, the UI managing part 814 displays an inspectioncontent selection button 1701. In this example, a tool for measuring atotal area of a flaw has been selected by the inspection contentselection button 1701. When the addition button 1404 is operated, the UImanaging part 814 switches the UI.

FIG. 18 shows a measurement region setting UI 1800. The measurementregion setting UI 1800 is provided with a frame 1802 for showing ameasurement region. A shape of the frame 1802 is changeable, and forexample, any shape out of a plurality of shapes is selected by apull-down menu 1801 for selecting the shape. The UI managing part 814renders the frame 1802 having the shape selected by the pull-down menu1801 to the display region 1103. The UI managing part 814 changes aposition and a size of the frame 1802 in accordance with designationfrom the input part 6.

FIG. 19 shows a setting UI 1900 for setting flaw detecting conditions.The setting UI 1900 is provided with a pull-down menu 1901 for selectinga flaw detecting direction, a box 1902 for designating a flaw segmentsize, and a slider 1903 for designating a flaw level. When the flawinspection part 831 detects a flaw based on the flaw detectingconditions set by the setting UI 1900, the UI managing part 814 maydisplay a flaw detection mark 1910 at a position of the flaw. Thisallows the user to judge whether or not the flaw detection conditionsare suitable.

<Inspection Mode>

FIG. 20 is a flowchart showing the inspection mode. When the start ofthe inspection mode is designated through the input part 6, theprocessor 810 switches the operation mode to the inspection mode.

In S2001, the processor 810 captures and acquires an image of theworkpiece 2 while switching the illumination direction in accordancewith the set illumination pattern. Specifically, the illuminationcontrol part 812 specifies the illumination pattern with reference tothe setting data held in the storage device 820, and transmits a commandfor designating the illumination pattern to the illumination controller802. The imaging control part 813 specifies control parameters (shutterspeed, sensitivity, and the like) concerning the camera 4 with referenceto the setting data held in the storage device 820, and transmits acommand for designating the control parameters to the camera 4. Thephotometric processing part 811 transmits a trigger signal fordesignating the start of illumination to the illumination controller802, and in conjunction with this, the photometric processing part 811transmits a trigger signal for designating the start of imaging to thecamera 4. The illumination controller 802 switches the illuminationdirection in synchronization with the trigger signal. For example, inaccordance with the illumination pattern designated by the command, theillumination controller 802 lights the corresponding light-emittingelements sequentially one by one with respect to the four illuminationdirections. The illumination controller 802 may hold the correspondingrelation between the command and the illumination pattern in a memory orthe like. Only one trigger signal may be issued at the start ofillumination, or the trigger signal may be issued at switching timing.The camera 4 captures an image of the workpiece 2 in accordance with thecontrol parameters, and transfers the luminance image to the imageprocessing apparatus 5. In such a manner, for example, one luminanceimage is generated for one illumination direction.

In S2002, the processor 810 obtains the normal vector n and thereflectance p from the plurality of luminance images. As describedabove, the photometric processing part 811 applies Expression 1 to pixelvalues of the plurality of luminance images, to obtain the normal vectorn and the reflectance ρ.

In S2003, the processor 810 generates an inspection image in accordancewith the set characteristic size. As described above, the photometricprocessing part 811 decides the weight W corresponding to thecharacteristic size from a weight table or the like, and performs theaccumulation computing by using Expression 2, to generate an inspectionimage (inclination image). As thus described, the photometric processingpart 811 may generate an inclination image having a pixel value based onthe normal vector n of the surface of the workpiece 2 from the pluralityof luminance images. When a plurality of characteristic sizes withrespectively different values are set, the photometric processing part811 may generate an inspection image with respect to each of theplurality of characteristic sizes. Further, the photometric processingpart 811 may generate a reflectance image or a texture image by theforegoing technique. For example, the photometric processing part 811may calculate the reflectance ρ of the surface of the workpiece 2 alongwith the normal vector n of the surface of the workpiece 2 from theplurality of luminance images, to generate a reflectance image having apixel value based on the reflectance ρ. Here, an image to be inspectedis generated, and generation of an image not to be inspected may beomitted.

In S2004, the processor 810 displays the inspection image on the displaypart 7. The UI managing part 814 may simultaneously or selectivelydisplay on the display part 7 the luminance image, the inclinationimage, and the reflectance image along with the inspection image. Whenthe images are selectively displayed, the UI managing part 814 may, forexample, display the four luminance images by sequentially switching inaccordance with switching designation from the input part 6. Forexample, out of the input part 6, a specific key provided in the consolemay be allocated as an image switching button.

In S2005, the processor 810 designates the image processing part 830 toexecute the inspection. When the inspection is designated, the imageprocessing part 830 activates a previously set inspection tool, toexecute the inspection on the inspection image. For example, the flawinspection part 831 discriminates a flaw level in accordance with theset measurement region and detection conditions, and transmits a resultof the inspection (flaw level) to the determination part 840. Note thatthe flaw inspection part 831 may execute a pattern search by using theforegoing reference image and set an inspection region, to execute theinspection in the inspection region. Further, the OCR part 832 performscharacter recognition processing on the inspection image in accordancewith a previously set character recognition setting, and transmits aresult of the character recognition to the determination part 840. TheOCR part 832 may also execute a pattern search by using the foregoingreference image and set an inspection region (character recognitionregion), to execute inspection in the inspection region.

In S2006, the determination part 840 of the processor 810 compares theinspection result and a determination threshold, to determine whether ornot the workpiece 2 is a non-defective product. For example, in a casewhere a setting has been performed so as to execute both the flawinspection and the OCR, the determination part 840 determines theworkpiece 2 as a non-defective product when both of the result of theinspection by the flaw inspection part 831 and the result of thecharacter recognition by the OCR part 832 are at passing levels.

<Image Saving Setting>

FIG. 21 shows one example of a UI 2100 for setting an inspection flow.The UI managing part 814 displays the UI 2100 on the display part 7, andsets a plurality of steps to be performed from the start to the end ofthe inspection flow in accordance with designation inputted from theinput part 6. In this example, an imaging step, a pattern search step, aposition correcting step and a flaw inspecting step are added to theinspection flow. For example, when the end of the inspection flow isdesignated through the input part 6, the UI managing part 814 mayperform such a setting as to store an inspection history at the end. Theinspection history is an inspection result, an image used in theinspection, and the like.

At the time of adding each step, the UI managing part 814 may acceptselection of an image to be used in each step through the input part 6.For example, through the input part 6, the user may designate fourluminance images with four different illumination directions, aninclination image, a reflectance image, or the like as an acquirementtarget for the imaging step. The user may designate any of luminanceimages (all-directional illumination image, etc.) as a search target forthe pattern search step. The user may designate an inspection imagegenerated from the inclination image as an inspection target for theflaw inspecting step. In the present embodiment, a plurality of shapeimages and a reflection image generated from the plurality of luminanceimages captured in the imaging step can be outputted in the later-stageinspection step, whereby the user can apply a plurality of inspectionimages generated from the common imaging step to a variety ofinspections corresponding to characteristics of each image.

FIG. 22 shows one example of a UI 2200 for setting a condition forstoring histories. A setting part 2201 for setting identificationinformation for identifying the storage condition is a pull-down menufor selecting identification information to be set from a plurality ofpieces of identification information. In this example, in the settingpart 2201, a storage condition for identification information of “0:” isselected. Examples of the storage condition includes a condition thatimages are stored only when an inspection result shows that theworkpiece is not a non-defective product, and a condition that imagesare constantly stored for each workpiece without depending on theinspection result. Here, the processor 810 activates the conditionsetting part 819 when detecting that a detail setting button or the likeis pressed. The condition setting part 819 may, for example, set one ofa mode for constantly saving or outputting an image, and a mode forsaving or outputting an image when the determination part 840 determinesthat an inspection target is not a non-defective product. An imageselection part 2202 selects an image that is saved when the storagecondition is satisfied. Here, “all” or “designate” can be selected bythe image selection part 2202. A saving destination selection part 2203is a pull-down menu for selecting an image saving destination (e.g., aportable medium such as an internal memory or a memory card, or networkstorage such as an FTP server).

FIG. 23 shows one example of a UI 2300 that the UI managing part 814displays on the display part 7 when “designate” is selected in the imageselection part 2202. In this example, there is provided a check box 2301for selecting an image to be actually saved out of all types of imageshandled in the inspection flow. “Shape 1” and “shape 2” are inspectionimages (inclination images) with different characteristic sizes.“Texture” is a reflectance image. “Normal” is an image acquired byall-directional illumination. Each of arrows in four directionsindicates an image for each illumination direction. An image whose checkbox is checked is set as an image to be saved.

Incidentally, the processor 810 may be provided with a judgment sectionfor judging whether or not a condition for saving or outputting an imageis satisfied after the determination part 840 completes thedetermination. That is, in the end part of the inspection flow, theprocessor 810 may judge whether or not the storage condition or theoutput condition set by the condition setting part 819 is satisfied.

FIG. 24 shows an example of adding an image outputting step 2401 to theinspection flow. In the foregoing example, the setting has beenperformed so as to output an image at the end of the inspection flow,but in this example, the UI managing part 814 sets the image outputtingstep 2401 at an arbitrary position of the inspection flow in accordancewith the user's designation inputted from the input part 6. In such amanner, the processor 810 may judge whether or not the condition forsaving or outputting an image is satisfied in the image outputting step2401 located before the determination part 840 completes thedetermination. The storage setting and the like related to the imageoutputting step 2401 may be similar to those described using FIGS. 21 to23, or may be different.

FIG. 25 shows a different example of a UI related to the storage setting(output setting). In a state where the image outputting step 2401 hasbeen selected by the input part 6, when designation to start a settingis further inputted by the input part 6, the UI managing part 814displays a UI 2501. An image variable 2502 functions as an imageselection part for selecting an image to be outputted, and in thisexample, an image to be outputted is designated by the image variablethat is added to each step in the inspection flow. That is, the image tobe outputted can be selected for each step. In the UI 2501, the numberof outputted images, an image form, and the like may be set. An outputdestination selection part 2503 is a pull-down menu for selecting animage outputting destination (e.g., a portable storage medium such as aninternal memory or a memory card, or network storage such as an FTPserver).

FIG. 26 is one example of a UI 2600 for selecting an image. When adetail setting button is pressed down in the UI 2501, the UI managingpart 814 displays a UI 2600. The UI 2600 is provided with a radio buttonfor selecting whether to save all images or to individually designatethe images, check boxes for individually selecting the images, and thelike. In this example, since the individual setting is selected by theradio button, check boxes are enabled, and several images are selectedby the check boxes. In such a manner, an image to be saved or outputtedmay be selected out of a plurality of luminance images, an inspectionimage, an all-directional illumination image, and a synthesizedluminance image obtained by synthesizing the plurality of luminanceimages. Further, the UI 2600 may be configured so as to select an image,which is to be saved or outputted, out of a plurality of inspectionimages with respectively different characteristic sizes. Moreover, theUI 2600 may be configured such that an image to be saved or outputtedcan be selected out of a plurality of luminance images, an inspectionimage, and a reflectance image whose pixel value is a reflectance of thesurface of the inspection target.

<Summary>

According to the present embodiment, the photometric processing part 811calculates a normal vector of the surface of the workpiece 2 from aplurality of luminance images acquired by the camera 4 in accordancewith the photometric stereo method, and performs accumulation computingof a pixel value of a pixel of interest by using a normal vector of apixel adjacent to the pixel of interest with respect to an inclinationimage made up of pixel values based on the normal vector calculated fromthe plurality of luminance images and a reduced image of the inclinationimage, to generate an inspection image having the pixel value. Further,the photometric processing part 811 may generate an inclination imageand at least one reduced image of the inclination image, and performsynthesis processing of synthesizing at least two images out of theinclination image and at least one reduced image, to generate aninspection image showing a surface shape of the inspection target. Inparticular, according to the present embodiment, there is provided thecharacteristic size setting part 815 for setting a characteristic sizewhich is a parameter for giving weight to a component of a reduced imagethat is used in the synthesis processing (e.g., accumulation computing).As thus described, by introducing the concept of the characteristicsize, a parameter can be easily set at the time of generating aninspection image from an image acquired by using the photometric stereoprinciple. Note that the photometric processing part 811 can generate adifferent inspection image in accordance with a characteristic size setby the characteristic size setting part 815. The photometric processingpart 811 may generate a plurality of reduced images with respectivelydifferent reduction ratios. Further, when the characteristic size ischanged by the characteristic size setting part 815, the photometricprocessing part 811 may change the characteristic size with respect tothe acquired inclination image without re-imaging, to update theinspection image. Since this eliminates the need for re-capturing animage, reproduction of an imaging environment at the time of setting isnot required, and hence it is possible to perform an optimum settingwhile changing the setting for the characteristic size with respect tothe image which has been captured and stored. The characteristic sizesetting part 815 may set different characteristic sizes in a stepwisemanner corresponding to an inspection application. For example, it isconsidered that the characteristic size may be set in a stepwise mannercorresponding to the application, e.g., the characteristic size israther small in the flaw inspection mode and the characteristic size israther large in the OCR recognition mode. For example, thecharacteristic size may be set in a stepwise manner corresponding to theapplication, e.g., the characteristic size is rather small in the flawinspection mode and the characteristic size is rather large in the OCRrecognition mode. This is useful when a suitable characteristic size ispreviously unknown.

The characteristic size setting part 815 may set a plurality ofcharacteristic sizes with respectively different values. In this case,the photometric processing part 811 may generate an inspection imagewith respect to each of the plurality of characteristic sizes set by thecharacteristic size setting part 815. It is considered that a suitablecharacteristic size differs according to a type of the inspection tool.Therefore, generating inspection images in accordance with a pluralityof characteristic sizes with respectively different values isadvantageous in selecting a more suitable image corresponding to theinspection.

The flaw inspection part 831 may execute flaw inspection on a pluralityof inspection images generated by using respectively differentcharacteristic sizes, and the determination part 840 may determinedefectiveness/non-defectiveness of the workpiece 2 by using a result ofthe inspection by the flaw inspection part 831. Executing the flawinspection on the plurality of inspection images eliminates the need forpreviously selecting one inspection image, which will be convenient forthe user. The OCR part 832 may perform character recognition processingon a plurality of inspection images generated by using respectivelydifferent characteristic sizes, and the determination part 840 maydetermine defectiveness/non-defectiveness of the workpiece 2 by using aresult of the character recognition by the OCR part 832. Performing thecharacter recognition processing on the plurality of inspection imageseliminates the need for previously selecting one inspection image, whichwill be convenient for the user.

Originally, a height image showing a height of the workpiece 2 can begenerated by the photometric stereo method. However, measuring theheight of the surface of the workpiece 2 requires a considerably strictsetting for a positional relation between the camera 4 and theillumination apparatus 3. Meanwhile, out of images obtained by thephotometric stereo method, shape information or texture (design)information can be used without acquiring height information. Forexample, when the flaw inspection or the OCR is to be performed, astrict setting for the camera 4 and the illumination apparatus 3 is notrequired. As thus described, when the inspection tool does not requireaccurate height data, it is possible to alleviate the arrangementconditions for the camera 4 and the illumination apparatus 3. Note thatthe number of illumination directions may be three or more.

The photometric processing part 811 may calculate a reflectance of thesurface of the workpiece 2 along with a normal vector of the surface ofthe workpiece 2 from the plurality of luminance images acquired by thecamera 4, to generate a reflectance image made up of pixel values basedon the reflectance, and the determination part 840 may determinedefectiveness/non-defectiveness of the workpiece 2 by using thereflectance image. This is because there also exists an inspection toolin which a reflectance image is suitably used for the inspection. Thephotometric processing part 811 may generate an inclination image madeup of pixel values based on a normal vector of the surface of theworkpiece 2 from the plurality of luminance images acquired by thecamera 4, and the determination part 840 may determinedefectiveness/non-defectiveness of the workpiece 2 by using theinclination image. This is because there also exists an inspection toolin which an inclination image is suitably used for the inspection. Thedetermination part 840 may determine defectiveness/non-defectiveness ofthe workpiece 2 by using a luminance image. This is because there alsoexists an inspection tool in which a luminance image before beingprocessed into an inclination image or a reflectance image is suitablyused for the inspection. The determination part 840 may determinedefectiveness/non-defectiveness of the workpiece 2 by using at least oneluminance image out of a plurality of luminance images with respectivelydifferent illumination directions. Since there exists a flaw or the likethat becomes clear by differences in the illumination direction, aluminance image obtained by illuminating the workpiece 2 from a certaindirection is suitable for detecting such a flaw.

The determination part 840 may simultaneously light all the lightsources of the illumination apparatus 3 and determinedefectiveness/non-defectiveness of the workpiece 2 by using a luminanceimage acquired by the camera 4. That is, by using a so-calledall-directional illumination image, whether the workpiece 2 is defectiveor non-defective may be determined. For example, the all-directionalillumination image may be suitable for calculation of an area of acertain portion of the workpiece 2 or measurement of a length of aterminal.

The determination part 840 may synthesize a plurality of luminanceimages with respectively different illumination directions and determinedefectiveness/non-defectiveness of the workpiece 2 by using thegenerated synthesized luminance image. The synthesized luminance imageis an image similar to the all-directional illumination image.Therefore, by use of the synthesized luminance image in place of theall-directional illumination image, it is possible to execute theinspection without acquiring the all-directional illumination image. Inthe case where an all-directional illumination image is required, it isnecessary to acquire four luminance images with respectively differentillumination directions and one all-directional illumination imageobtained by simultaneous illumination from four directions. That is,five times of illumination and five times of imaging are required. Onthe other hand, when the synthesized luminance image is used, four timesof illumination and four times of imaging may be performed. In such amanner, adopting the synthesized luminance image can reduce a processingload of the processor 810 when a plurality of inspection images arerequired to be processed in a short period of time. Further, as thenumber of acquired images is increased, it becomes necessary to lower aconveying speed of the line 1. However, in the present embodiment, sincethe number of acquired images can be reduced, the conveying speed of theline 1 can be increased.

The storage device 820 may store and hold an inspection image. Thedetermination part 840 or the image processing part 830 may read theinspection image from the storage device 820 and execute the inspection,to determine defectiveness/non-defectiveness of the workpiece 2 based onthe inspection result. Note that the storage device 820 may be any ofthe internal memory, the portable type storage medium, and the networkstorage. For example, when an inspection image is stored into theportable type storage medium or the network storage, it is possible toperform inspection processing in an apparatus different from theapparatus that has generated the inspection image.

The storage device 820 may store a plurality of inspection imagesgenerated by applying characteristic sizes with respectively differentvalues. In addition to the inspection image, the storage device 820 maystore at least one of an inclination image and a reflectance image. Theimage selection part 816 may select one inspection image out of aplurality of inspection images. Further, the inspection tool settingpart 817 may set an inspection tool for the inspection image selected bythe image selection part 816. Among the plurality of inspection imagesgenerated by applying the characteristic sizes with respectivelydifferent values, an inspection image not required for the inspectionmay exist. Hence, the user may set an inspection image in accordancewith an inspection tool.

As described using FIG. 15 and the like, the image processing part 830may execute a pattern search by using a reference image acquired from anon-defective product, to set an inspection region. The determinationpart 840 may determine defectiveness/non-defectiveness of the workpiece2 by using a result of the inspection executed in the inspection region.The inspection region is, for example, a character recognition region.

As described using FIG. 11 and FIGS. 21 to 26, the image selection part816 may select an image, which is to be saved or outputted, out of aplurality of luminance images acquired by the camera 4 and an inspectionimage. Further, the image selection part 816 may select an image, whichis to be saved or outputted, out of a plurality of luminance images, aninspection image, a luminance image acquired by lighting all of aplurality of light sources provided in the illumination apparatus 3, anda synthesized luminance image obtained by synthesizing the plurality ofluminance images. Moreover, the image selection part 816 may select animage, which is to be saved or outputted, out of a plurality ofinspection images with respectively different characteristic sizes.Furthermore, the image selection part 816 may select an image, which isto be to be saved or outputted, out of a plurality of luminance images,an inspection image, and a reflectance image whose pixel value is areflectance of the surface of the workpiece 2. As thus described,allowing an image related to the inspection to be selected asappropriate will facilitate saving or outputting of a desired image.

The condition setting part 819 for setting a condition for saving oroutputting an image may further be provided. For example, as describedusing FIGS. 22 and 26, the condition setting part 819 may, for example,set one of the mode for constantly saving or outputting an image, andthe mode for saving or outputting an image when the determination part840 determines that the workpiece 2 is not a non-defective product. Asdescribed using FIGS. 21 to 26, the processor 810 may judge whether ornot the condition for saving or outputting an image is satisfied beforeor after the determination part 840 completes the determination. Forexample, whether or not an image is saved may be judged at the timepoint when the inspection is completed in the inspection flow, orwhether or not an image is saved may be judged in any step of theinspection flow. In particular, in the latter case, it is also possibleto save an intermediate image generated in the middle of the inspectionflow. Such an intermediate image will be useful at the time of searchingfor a cause of failure in the inspection and adjusting a controlparameter.

What is claimed is:
 1. An inspection apparatus comprising: anillumination section for illuminating an inspection target in accordancewith a photometric stereo method; an imaging section for receivingreflective light from the illuminated inspection target to generate aluminance image in accordance with the photometric stereo method; acomputing section for calculating a normal vector of a surface of theinspection target from a plurality of luminance images acquired by theimaging section, generating an inclination image made up of pixel valuesbased on the normal vector calculated from the plurality of luminanceimages and at least one reduced image of the inclination image, andperforming synthesis processing of synthesizing at least two images outof the inclination image and the at least one reduced image, to generatean inspection image showing a surface shape of the inspection target; adetermination section for determining defectiveness/non-defectiveness ofthe inspection target by using the inspection image; and a settingsection for setting a characteristic size which is a parameter forgiving weight to a component of the reduced image at the time ofperforming the synthesis processing, wherein the computing sectiongenerates a different inspection image in accordance with thecharacteristic size set by the setting section.
 2. The inspectionapparatus according to claim 1, wherein the computing section generatesa plurality of reduced images using different reduction ratios.
 3. Theinspection apparatus according to claim 1, wherein, when thecharacteristic size is changed by the setting section, the computingsection changes the characteristic size with respect to the acquiredinclination image without re-imaging by the imaging section, to updatethe inspection image.
 4. The inspection apparatus according to claim 1,wherein the setting section sets different characteristic sizes in astepwise manner corresponding to an inspection application.
 5. Theinspection apparatus according to claim 1, wherein the setting sectionsets a plurality of characteristic sizes with respectively differentvalues, and the computing section generates the inspection image withrespect to each of the plurality of characteristic sizes set by thesetting section.
 6. The inspection apparatus according to claim 1,further comprising a flaw inspection section for executing flawinspection on a plurality of inspection images generated by usingrespectively different characteristic sizes, wherein the determinationsection determines defectiveness/non-defectiveness of the inspectiontarget by using a result of the inspection by the flaw inspectionsection.
 7. The inspection apparatus according to claim 1, furthercomprising a character recognizing section for performing characterrecognition processing on a plurality of inspection images generated byusing respectively different characteristic sizes, wherein thedetermination section determines defectiveness/non-defectiveness of theinspection target by using a result of the character recognition by thecharacter recognizing section.
 8. The inspection apparatus according toclaim 1, wherein the computing section calculates a reflectance of thesurface of the inspection target along with a normal vector of thesurface of the inspection target from a plurality of luminance imagesacquired by the imaging section, to generate a reflectance image whosepixel value is the reflectance, and the determination section determinesdefectiveness/non-defectiveness of the inspection target by using thereflectance image.
 9. The inspection apparatus according to claim 1,wherein the computing section generates an inclination image made up ofpixel values based on a normal vector of the surface of the inspectiontarget from a plurality of luminance images acquired by the imagingsection, and the determination section determinesdefectiveness/non-defectiveness of the inspection target by using theinclination image.
 10. The inspection apparatus according to claim 1,further comprising a storage section for storing the inspection image,wherein the determination section reads the inspection image from thestorage section and executes inspection, to determinedefectiveness/non-defectiveness of the inspection target based on aresult of the inspection.
 11. The inspection apparatus according toclaim 10, wherein the storage section stores a plurality of inspectionimages generated by applying characteristic sizes with respectivelydifferent values.
 12. The inspection apparatus according to claim 1,further comprising: a selection section for selecting one inspectionimage out of a plurality of inspection images; and an inspection toolsetting section for setting an inspection tool for the inspection imageselected by the selection section.
 13. The inspection apparatusaccording to claim 1, further comprising an image selection section forselecting an image, which is to be saved or outputted, out of aplurality of luminance images acquired by the imaging section and theinspection image.
 14. The inspection apparatus according to claim 13,wherein the image selection section selects an image, which is to besaved or outputted, out of the plurality of luminance images, theinspection image, a luminance image acquired by lighting all of theplurality of light sources provided in the illumination sections, and asynthesized luminance image obtained by synthesizing the plurality ofluminance images.
 15. The inspection apparatus according to claim 13,wherein the image selection section selects an image, which is to besaved or outputted, out of the plurality of inspection images withrespectively different characteristic sizes.
 16. The inspectionapparatus according to claim 13, wherein the image selection sectionselects an image, which is to be saved or outputted, out of theplurality of luminance images, the inspection image, and a reflectanceimage whose pixel value is a reflectance of the surface of theinspection target.
 17. The inspection apparatus according to claim 13,further comprising a condition setting section for setting a conditionfor saving or outputting an image.
 18. The inspection apparatusaccording to claim 17, wherein the condition setting section sets one ofa mode for constantly saving or outputting an image and a mode forsaving or outputting an image when the determination section determinesthat the inspection target is not a non-defective product.
 19. Acomputer storing a program that causes the computer as: an illuminationsection for illuminating an inspection target in accordance with aphotometric stereo method; an imaging section for receiving reflectivelight from the illuminated inspection target to generate a luminanceimage in accordance with the photometric stereo method; a computingsection for calculating a normal vector of a surface of the inspectiontarget from a plurality of luminance images acquired by the imagingsection, and performing synthesis processing of synthesizing at leasttwo images out of an inclination image made up of pixel values based onthe normal vector calculated from the plurality of luminance images andat least one reduced image of the inclination image, to generate aninspection image showing a surface shape of the inspection target; adetermination section for determining defectiveness/non-defectiveness ofthe inspection target by using the inspection image; and a settingsection for setting a characteristic size which is a parameter forgiving weight to a component of the reduced image at the time ofperforming the synthesis processing, wherein the computing sectiongenerates a different inspection image in accordance with thecharacteristic size set by the setting section.
 20. An inspection methodcomprising: an illumination step of illuminating an inspection target inaccordance with a photometric stereo method; an imaging step ofreceiving reflective light from the illuminated inspection target togenerate a luminance image in accordance with the photometric stereomethod; a computing step of calculating a normal vector of a surface ofthe inspection target from a plurality of luminance images acquired bythe imaging step, and performing synthesis processing of synthesizing atleast two images out of an inclination image made up of pixel valuesbased on the normal vector calculated from the plurality of luminanceimages and at least one reduced image of the inclination image, togenerate an inspection image showing a surface shape of the inspectiontarget; and a determination step of determiningdefectiveness/non-defectiveness of the inspection target by using theinspection image, the method further comprising a setting step ofsetting a characteristic size which is a parameter for giving weight toa component of the reduced image at the time of performing the synthesisprocessing, wherein in the computing step, a different inspection imageis generated in accordance with the characteristic size set in thesetting step.